-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NEW LinkField Behat tests #201
NEW LinkField Behat tests #201
Conversation
b24c9b7
to
bb1c998
Compare
Failed tests require silverstripe/silverstripe-frameworktest#162 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You've committed the two behat files with tabs instead of spaces. Please use 2 spaces per indent.
As per the frameworktest PR, copy in code form that PR as extensions and update this test to use those here
# Test that user can reorder links | ||
|
||
## These test steps give inconsistent results, not always passed | ||
# And I drag the "#Form_ElementForm_1_PageElements_1_ManyLinks_Holder .link-picker__link--is-first" element to the "#Form_ElementForm_1_PageElements_1_ManyLinks_Holder .link-picker__link--is-last" element | ||
# And I wait for 5 seconds | ||
# Then I press the "Publish" button | ||
# Then I click on the ".element-editor__element" element | ||
# And I should see "All about us" in the "#Form_ElementForm_1_PageElements_1_ManyLinks_Holder .link-picker__link--is-last" element | ||
# And I should see "Phone" in the "#Form_ElementForm_1_PageElements_1_ManyLinks_Holder .link-picker__link--is-first" element |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# Test that user can reorder links | |
## These test steps give inconsistent results, not always passed | |
# And I drag the "#Form_ElementForm_1_PageElements_1_ManyLinks_Holder .link-picker__link--is-first" element to the "#Form_ElementForm_1_PageElements_1_ManyLinks_Holder .link-picker__link--is-last" element | |
# And I wait for 5 seconds | |
# Then I press the "Publish" button | |
# Then I click on the ".element-editor__element" element | |
# And I should see "All about us" in the "#Form_ElementForm_1_PageElements_1_ManyLinks_Holder .link-picker__link--is-last" element | |
# And I should see "Phone" in the "#Form_ElementForm_1_PageElements_1_ManyLinks_Holder .link-picker__link--is-first" element |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
I want to add links to pages, files, external URLs, email addresses and phone numbers | ||
|
||
Background: | ||
Given I add an extension "SilverStripe\FrameworkTest\LinkField\Extensions\LinkPageExtension" to the "Page" class |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update this to the new namespace of the extension copied in from the frameworktest PR
Also add in the new ElementContent extension I've mentioned on the frameworktest PR
Do this for the other behat file as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
And I wait for 5 seconds | ||
Then I should see "Link to external URL" in the ".modal-header" element | ||
Then I fill in "Form_LinkForm_0_Title" with "External URL" | ||
Then I fill in "Form_LinkForm_0_ExternalUrl" with "https://www.silverstripe.org" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also add in a quick test here with an invalid URL to test that validation is working, then update it to a valid url
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
3b358d5
to
294da79
Compare
Then I should see "Page on this site" in the ".modal-header" element | ||
And I wait for 2 seconds | ||
And I press the "Create link" button | ||
Then I should see "Page is required" in the ".modal-content" element |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add test for validation
And I wait for 5 seconds | ||
Then I should see "Link to external URL" in the ".modal-header" element | ||
Then I fill in "Form_LinkForm_0_LinkText" with "External URL" | ||
And I fill in "Form_LinkForm_0_ExternalUrl" with "w1234@$%" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add test for invalid URL
Scenario: I can create link blocks page | ||
Given I press the "Add block" button | ||
# There are few buttons on the page with 'Content' text | ||
Then I click on the ".font-icon-block-content" element |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have to change this to class name since there are more than one "Content" button on the page
|
||
Background: | ||
Given I add an extension "SilverStripe\FrameworkTest\LinkField\Extensions\LinkPageExtension" to the "Page" class | ||
And I go to "/dev/build?flush" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should rebuild DB after new Extension was applied.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You still need to update the behat files to use spaces instead of tabs
294da79
to
6ff2d80
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will merge once the corresponding frameworktest PR is merge
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You'll need to add "silverstripe/frameworktest": "^1" to "require-dev" in composer.json
6ff2d80
to
da7c7c9
Compare
Updated. Sorry, I removed and forgot to return back. |
da7c7c9
to
1c54da7
Compare
1c54da7
to
24bf1ee
Compare
Description
These changes add integration testing and test the operation of the linkfield as part of the SMS page and as part of the Elemental Block. The tests cover the following main aspects of the module's operation:
Parent issue
New issue
A problem was identified when using Mock classes that implement the TestOnly interface in Behat tests. Most likely, these classes are ignored when creating database tables, making it impossible to test complex relationships between classes.
Note
silverstripe / frameworktest
and passed. See here